<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>帮帮网</title>

<link href="css/layout.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="JS/md5.js"></script>
<script type="text/javascript" src="JS/httpRequest.js"></script>
<script type="text/javascript" src="JS/cookie.js"></script>
<script type="text/javascript">
//var userID;
//var helps;
function getUserID()
{
	username=getCookie('username');
	userID = getCookie('userID');
}
function Login()
{
	
	var warn=document.getElementById('warn');
	var username=document.getElementById('txtUsername').value;
	if(username==null ||username=="")
	{
		warn.innerHTML="您还没有填写账号";
		return;
	}
	var pwd=document.getElementById('txtPwd').value;
	if(pwd==null ||pwd=="")
	{
		warn.innerHTML="您还没有填写密码";
		return;
	}
	
	var url="user/user.php?action=GetUser";
	var para="username="+username;
	para+="&password="+hex_md5(pwd);
	var response=SendPostRequest(url,para);
	alert(response);
	if(response=="false")
	{
		warn.innerHTML="登录失败！用户名或密码错误！";
		return;
	}
	else
	{
	//TODO
	//记录用户登录时间 并比对上次的登陆时间 刷新活跃度
		alert(response);
		document.cookie="username"+"="+username+";path=/;";
		document.cookie="userID"+"="+response+";path=/;";
		if (username!=null || username!="")
		{
			alert('Welcome again '+username+'! 每天都登陆的话 会增加您的活跃度 但是一天之中反复登陆是没有用的哦')
		}
		else
		{
			alert('???');
		}

		//window.location.href="../index.htm";
		window.location.href="user.html";

	}
}

</script>
</head>
<body onload="getUserID();" >
<div id="container">
<div class="head">
  <div id="logo"></div>
  <div class="menu">
    <div class="toolbar">Welcome！&nbsp;&nbsp;<a href="login.htm">&nbsp;登录&nbsp;</a> <a href="register.html">&nbsp;注册&nbsp;</a></div>
    <ul>
      <li class="hover"><em></em><a href="index.html">帮帮大厅</a></li>
      <li><a href="user.html">我的主页</a></li>
      <li><a href="bulletin.html">公告</a></li>
    </ul>
    <div class="count"><span>未解决：<a href="#">11110769个</a> 已解决：<a href="#">736998个</a></span><em></em></div>
  </div>
  <!--menu end-->
</div>
<!--head end-->
<div class="space_h"></div>
<div class="maintop"></div>
<div class="main">
  <div id="login">

          <h1>人人为我 我为人人</h1>
          <form action="#">
            <table width="388">
              <tr>
                <td width="63"></td>
                <td width="273"><span id="warn" class="warning"></span></td>
                <td width="36"></td>
              </tr>
              <tr>
                <td class="form_name" align="left">用户名：</td>
                <td class="form_input"><input id="txtUsername" type="text" size="24" class="input_text"/></td>
                <td class="warning" id="nameWarn">*</td>
              </tr>
              <tr>
                <td class="form_name" align="left">密码：</td>
                <td class="form_input"><input type="password" size="24"  id="txtPwd" class="input_text"/></td>
                <td id="pwdWarn" class="warning">*</td>
              </tr>
              <tr>
                <td colspan="3" align="center" ><input class="form_submit" type="button" value="登陆" onclick="Login()" title="如果坚持每天登录的话 会按照kakassi法则给予活跃度奖励" />                </td>
              </tr>
            </table>
	  </form>
          <p>&gt; 还没有帮帮网账号？<a href="register.html" target="_self">立即注册</a> </p>
          <p>&nbsp;</p>
  </div>
</div>
  <!--main end-->
  <div class="mainbot"></div>
  <div class="space_h"></div>
  <div class="foot">&copy;2007 - 2011 帮帮网  文网文[2011]0000-000  沪ICP备080808080号-2</div>
</div>
<!--container end-->
<script type="text/javascript" src="http://js.tongji.linezing.com/2587587/tongji.js"></script><noscript><a href="http://www.linezing.com"><img src="http://img.tongji.linezing.com/2587587/tongji.gif"/></a></noscript>
</body>
</html>
